package com.moyu.user.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.moyu.common.core.domain.PermissionLoginDTO;
import com.moyu.common.core.domain.RoleLoginDTO;
import com.moyu.user.domain.permission.dto.PermissionQueryDTO;
import com.moyu.user.domain.role.Role;
import com.moyu.user.domain.role.dto.PermissionByRoleQueryDTO;
import com.moyu.user.domain.role.dto.RolePermissionSavaDTO;
import com.moyu.user.domain.role.vo.RoleListVO;
import com.moyu.user.domain.role.dto.RoleQueryDTO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;
import java.util.Set;

/**
 * 角色数据库访问层
 *
 * @Author 赵彦博
 * @Date 2025/3/25 18:29
 */
@Mapper
public interface RoleMapper extends BaseMapper<Role> {

    Set<PermissionLoginDTO> selectPermissionByUserId(Long userId);

    Set<RoleLoginDTO> selectRoleByUserId(Long userId);

    List<RoleListVO> selectRoleList(RoleQueryDTO roleQueryDTO);

    int deleteRoleById(Long roleId);

    List<PermissionQueryDTO> selectRolePermissionList(PermissionByRoleQueryDTO dto);

    int removeRolePermission(PermissionByRoleQueryDTO dto);

    List<PermissionQueryDTO> availablePermission(PermissionByRoleQueryDTO dto);

    int addRolePermission(RolePermissionSavaDTO rolePermissionSavaDTO);
}
